package com.rt.system.service.impl;

import java.util.List;
import com.rt.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rt.system.mapper.RtDifficultyMapper;
import com.rt.system.domain.RtDifficulty;
import com.rt.system.service.IRtDifficultyService;

/**
 * 难易度配置Service业务层处理
 * 
 * @author Yg
 * @date 2022-04-13
 */
@Service
public class RtDifficultyServiceImpl implements IRtDifficultyService 
{
    @Autowired
    private RtDifficultyMapper rtDifficultyMapper;

    /**
     * 查询难易度配置
     * 
     * @param id 难易度配置主键
     * @return 难易度配置
     */
    @Override
    public RtDifficulty selectRtDifficultyById(Long id)
    {
        return rtDifficultyMapper.selectRtDifficultyById(id);
    }

    /**
     * 查询难易度配置列表
     * 
     * @param rtDifficulty 难易度配置
     * @return 难易度配置
     */
    @Override
    public List<RtDifficulty> selectRtDifficultyList(RtDifficulty rtDifficulty)
    {
        return rtDifficultyMapper.selectRtDifficultyList(rtDifficulty);
    }

    /**
     * 新增难易度配置
     * 
     * @param rtDifficulty 难易度配置
     * @return 结果
     */
    @Override
    public int insertRtDifficulty(RtDifficulty rtDifficulty)
    {
        rtDifficulty.setCreateTime(DateUtils.getNowDate());
        return rtDifficultyMapper.insertRtDifficulty(rtDifficulty);
    }

    /**
     * 修改难易度配置
     * 
     * @param rtDifficultys 难易度配置
     * @return 结果
     */
    @Override
    public int updateRtDifficulty( List<RtDifficulty> rtDifficultys)
    {
        for (RtDifficulty rtDifficulty : rtDifficultys) {
            rtDifficulty.setUpdateTime(DateUtils.getNowDate());
            rtDifficultyMapper.updateRtDifficulty(rtDifficulty);
        }
        return 1;
    }

    /**
     * 批量删除难易度配置
     * 
     * @param ids 需要删除的难易度配置主键
     * @return 结果
     */
    @Override
    public int deleteRtDifficultyByIds(Long[] ids)
    {
        return rtDifficultyMapper.deleteRtDifficultyByIds(ids);
    }

    /**
     * 删除难易度配置信息
     * 
     * @param id 难易度配置主键
     * @return 结果
     */
    @Override
    public int deleteRtDifficultyById(Long id)
    {
        return rtDifficultyMapper.deleteRtDifficultyById(id);
    }
}
